<table>
	<tfoot>
		<tr>
			<td>
				<div class="inner"><?php $this->load->view('admin/partials/pagination'); ?></div>
			</td>
		</tr>
	</tfoot>
	<tbody>
		<tr>	
			<td>
				<ul class="photo-list">
					<?php 
						$ci = &get_instance();
					?>				
					<?php
					$escortId =  $ci->media_entity->getObject($photos[0])->getEscortId();
					
					?>
					<li class="escort-name" style="width: 100%;">
						<span>
						<?php
						$escort = $ci->escort_entity->init('id', $escortId);
						if($escort){
							echo $escort->getEscortName();
							if($escort->getImageFaceCensor()){
								echo ' - '.lang('escort_be_photo_image_face_censor');
							}
						}
						?>
						</span>
					</li>
					<?php
					foreach ($photos as $item) :
					?>
					<?php
						$MEDIA = $ci->media_entity->getObject($item);
						if($escortId != $MEDIA->getEscortId()){
					?>
					<div class="clear"></div>
				</ul>
				<div class="clear"></div>
				<ul class="photo-list">
					<li class="escort-name" style="width: 100%;">
						<span>
						<?php
						$escortId = $MEDIA->getEscortId();
						$escort = $ci->escort_entity->init('id', $escortId);
						if($escort){
							echo $escort->getEscortName();
						} 
						?>
						</span>
						<div class="clear"></div>
					</li>
					<?php
						}
					?>
					<?php
					if($MEDIA->type == 'image'){ 
					?>
					<li>
						<div class="photo-item">
							<div class="photo-image">
							<?php
							if($MEDIA->getPermission() == 'public'){
								$imageUrl = $MEDIA->getTargetFileImagePublic(); 
							}else if($MEDIA->getPermission() == 'public_top'){
								$imageUrl = $MEDIA->getTargetFileImageTopPublic();
							}else{
								$imageUrl = $MEDIA->getTargetFileImageTopPublic();
							}
							?>
							<a href="<?php echo $imageUrl?>" class="media-photo" target="_blank" rel="group">
								<?php echo thumb($imageUrl,0,THUMB_H);?>
							</a>
							</div>
							<div class="photo-actions">
							<?php
								if($MEDIA->getReview()){ 
									echo anchor('./admin/be_photo/index/'.$pagination['current_page'], lang('escort_be_photo_reviewed_label'), 'class="btn orange reviewed photo-reviewed" id="'.$item->id.'"');
								}else{
									echo anchor('./admin/be_photo/index/'.$pagination['current_page'], lang('escort_be_photo_unreviewed_label'), 'class="btn orange reviewed photo-reviewed" id="'.$item->id.'"');
								} 
							?>
							
							<?php echo anchor('./admin/be_photo/download/'.$item->id, lang('escort_be_photo_download_label'), array('class'=>'btn orange download-photo', 'id' =>$item->id)); ?>
							</div>
							<div class="photo-actions-bottom">
							<?php echo anchor('./admin/be_photo/index/'.$pagination['current_page'], lang('global:edit'), 'class="btn orange edit photo-edit" id="'.$item->id.'"'); ?>
							<?php echo anchor('./admin/be_photo/index/'.$pagination['current_page'], lang('global:delete'), array('class'=>'btn red delete photo-delete', 'id' =>$item->id)); ?>
							</div>
						</div>
						<div class="clear"></div>
					</li>
					<?php
					}else{
					?>
					<li>
						<div class="photo-item">
							<div class="photo-image">
							<a href="<?php echo site_url()?>admin/be_photo/play_video/<?php echo $MEDIA->getId()?>" class="media-video">
								<?php echo thumb($MEDIA->getTargetFile('avatar'),THUMB_W,THUMB_H);?>
							</a>
							</div>
							<div class="photo-actions">
							<?php
								if($MEDIA->getReview()){ 
									echo anchor('./admin/be_photo/index/'.$pagination['current_page'], lang('escort_be_photo_reviewed_label'), 'class="btn orange reviewed photo-reviewed" id="'.$item->id.'"');
								}else{
									echo anchor('./admin/be_photo/index/'.$pagination['current_page'], lang('escort_be_photo_unreviewed_label'), 'class="btn orange reviewed photo-reviewed" id="'.$item->id.'"');
								} 
							?>
							
							
							</div>
							<div class="photo-actions-bottom">						
							<?php echo anchor('./admin/be_photo/index/'.$pagination['current_page'], lang('global:delete'), array('class'=>'btn red delete photo-delete', 'id' =>$item->id)); ?>
							</div>
						</div>
						<div class="clear"></div>
					</li>
					<?php
					} 
					?>
					<?php endforeach; ?>
					<div class="clear"></div>
				</ul>
				<div class="clear"></div>
			</td>
		</tr>
	</tbody>
</table>
<div id='confirm'>
	<div class='header'><span><?php echo lang('escort_confirm')?></span></div>
	<div class='message'><?php echo lang('escort_be_photo_delete_message')?></div>
		<div class='buttons'>
		<div class='no simplemodal-close'><?php echo lang('escort_be_photo_confirm_no')?></div><div class='yes'><?php echo lang('escort_be_photo_confirm_yes')?></div>
	</div>
</div>